package controllers

import (
	"fmt"
	"strconv"

	"github.com/beego/beego/v2/client/orm"
	beego "github.com/beego/beego/v2/server/web"
)

type CommentActionController struct {
	beego.Controller
}

func (c *CommentActionController) Get() {
	o := orm.NewOrm()
	var maps []orm.Params
	r := o.Raw("select count(*) from image")
	r.Values(&maps)
	fmt.Println(maps)
	idnow := maps[0]["count(*)"]
	fmt.Println(idnow)
	idnow_int, _ := strconv.Atoi(fmt.Sprint(idnow))
	imgUrls := [...]string{"avc", "dad", "dax"}
	for k, v := range imgUrls {
		o.Raw("INSERT INTO  image (img_Id, imgUrl) VALUES (?,?);", idnow_int+k, v).Exec()
	}
	c.TplName = "home.tpl"

}
